﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OtherDevice.ComDrive
{
    [Description("正洪光源控制器-ZH-HL24-2C-1T")]
    public class Light_正洪 : LightCtrlBase
    {

        public Light_正洪(string strName) : base(strName)
        {
            controlFrom = new XNCLightCtrl();
        }

        public override int Get(int channel)
        {
            throw new NotImplementedException();
        }
        public override bool Set(int channel, int value)
        {
            try
            {
               
                channel++;
                string v = value.ToString();
                for (int i = v.Length; i < 4; i++)
                { 
                      string  v1 = v.Insert(0, "0");
                    v = v1;
                }

             
                string cmd = $"Adjustn{channel}_{v}";

                byte[] byteRe = new byte[2];
                return SendAndReciveData(cmd, ref byteRe, 500);

            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show($"光源设置失败{ex}");
                return false;
            }
        }
    }
}
